//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2008 Manu Mital mitalmanu@hotmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


// ScripRef.cpp : implementation file
//

#include "stdafx.h"
#include "SwordBible.h"
#include "ScripRef.h"


// CScripRef dialog

IMPLEMENT_DYNAMIC(CScripRef, CDialog)

CScripRef::CScripRef(CWnd* pParent /*=NULL*/)
	: CDialog(CScripRef::IDD, pParent)
{

}

CScripRef::~CScripRef()
{
}

void CScripRef::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_RICHEDIT_SCRIPREF, richCtrl);
}


BEGIN_MESSAGE_MAP(CScripRef, CDialog)
	ON_WM_SIZE()
END_MESSAGE_MAP()


// CScripRef message handlers

void CScripRef::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	CWnd* pWnd = GetDlgItem(IDC_RICHEDIT_SCRIPREF);

	// resize the rich edit  control
	if( ::IsWindow(pWnd ->GetSafeHwnd() )) 
	pWnd ->SetWindowPos(NULL,10,40,cx-20,cy-50,SWP_NOZORDER | SWP_NOACTIVATE);



	// TODO: Add your message handler code here
}

void CScripRef::SetText(CString text)
{
	richCtrl.SetRTF(text);
}

BOOL CScripRef::OnInitDialog()
{
	CDialog::OnInitDialog();

	richCtrl.SetEventMask(ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_SCROLLEVENTS);
	richCtrl.SendMessage(EM_EXLIMITTEXT,0,-1);
	



	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
